#include <cstdio>
#include <algorithm>
#include <string>
#include <iostream>
using namespace std;
string s;
int main(void){
    int t;
    scanf("%d",&t);
    getchar();
    while(t--){
        getline(cin,s);
        reverse(s.begin(),s.end());
        cout << s << endl;

    }
    return 0;
}